package com.tanhua.admin.controller;

import com.tanhua.admin.service.DashboardService;
import com.tanhua.model.dto.DiagramDto;
import com.tanhua.model.vo.DiagramVo;
import com.tanhua.model.vo.SummaryVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;

/**
 * Created by ZhaoJun on 2022/1/6 19:20
 */
@RestController
@RequestMapping("/dashboard")
public class DashboardController {

    @Autowired
    private DashboardService dashboardService;

    /**
     * 展示次日流程，活跃，新增用户数据统计
     * @param dto
     * @throws ParseException
     */
    @GetMapping("/users")
    public ResponseEntity diagram(DiagramDto dto) throws ParseException {
        
        DiagramVo vo =dashboardService.getDiagram(dto);

        return ResponseEntity.ok(vo);
    }

    @GetMapping("/summary")
    public ResponseEntity summary() throws ParseException {

        SummaryVo vo = dashboardService.summary();

        return ResponseEntity.ok(vo);
    }




}
